#ifndef REGISTERWIDGET_H
#define REGISTERWIDGET_H

#include <QDialog>
#include <QSqlQuery>
#include <QSqlError>

namespace Ui {
class RegisterWidget;
}

class RegisterWidget : public QDialog
{
    Q_OBJECT

public:
    explicit RegisterWidget(QWidget *parent = nullptr);
    ~RegisterWidget();

signals:
    void registerSuccess(QString message);
    void registerFail(QString message);

private slots:
    void on_registerButton_clicked();
    void on_cancelButton_clicked();

private:
    Ui::RegisterWidget *ui;
    QString hashPassword(const QString &password);
    bool validateInput();
    bool checkUsernameExists(const QString &username);
    bool checkEmailExists(const QString &email);
    void setupValidators();
};

#endif // REGISTERWIDGET_H
